<script src='<?php echo DIR_JS?>ui.datepicker.js' type='text/javascript' language='javascript'> </script>
<!--begin-->
<div class="section">
    <div class="section-title">BÁO CÁO ĐIỀU CHỈNH DỮ LIỆU</div>
    <?php if($_GET['print'] !="true" ){ ?>
    <div class="right">
        <a class="button print" id="btnPrint">In</a>
        <a class="button exit" href="?route=deliman/home">Đóng</a>
    </div>
    <?php } ?>
	<div class="clearer">&nbsp;</div>
    
    <div class="section-content padding1">
        <div>
        <?php if($_GET['print'] !="true" ){ ?>
            <form name="frm" id="frm" action="" method="post" enctype="multipart/form-data">
                <table>
                    <thead>
                         <tr class="left">
                            <td>
                                <script language="javascript">
                                    $(function() {
                                        $("#tungay").datepicker({
                                                changeMonth: true,
                                                changeYear: true,
                                                dateFormat: 'dd-mm-yy'
                                                });
                                        $("#denngay").datepicker({
                                                changeMonth: true,
                                                changeYear: true,
                                                dateFormat: 'dd-mm-yy'
                                                });
                                        });
                                </script>
                                <label>Ngày thao tác:  </label>
                                <label>Từ ngày </label>
                                <input type="text" id="tungay" name="tungay" class="text" />
                                <label>Đến ngày </label>
                                <input type="text" id="denngay" name="denngay" class="text" />
                            </td>
                            <td>
                                <label>Nhân viên thao tác:</label>
                                <select id="nhanvienid" name="nhanvienid">
                                    <option value="">Chọn nhân viên</option>
                                        <?php 
                                            foreach($danhsachnhanvien as $nhanvien){ 
                                        ?>
                                    <option value="<?php echo $nhanvien['nhanvienid']?>" >
                                        <?php echo $nhanvien['hoten']?>
                                    </option>
                                        <?php 
                                            } 
                                        ?>
                                </select>
                            </td>
                            <td><a class="button-other search" onClick="searchForm()">Tìm kiếm</a></td>
                        </tr>
                    </thead>
                </table>
            </form>
        <?php } ?>
            <table class="data-table" width="100%">
                <thead>
                    <tr>
                        <th>Ngày thao tác</th>
                        <th>Chức năng</th>
                        <th>Hành động</th>
                        <th>CSDL</th>
                        <th>Trường dữ liệu</th>
                        <th>Dữ liệu cũ</th>
                        <th>Dữ liệu mới</th>
                        <th>Nhân viên thao tác</th>
                    </tr>
                </thead>    
                <tbody>
                    <?php
                        foreach($datas as $item)
                        {
                    ?>
                    <tr>
                        <td>
                            <?php echo $this->date->formatMySQLDate($item['ngaythaotac'], 'longdate')?>
                        </td>
                        <td><?php echo $item['chucnang']?></td>
                        <td><?php echo $item['hanhdong']?></td>
                        <td><?php echo $item['csdl']?></td>
                        <td><?php echo $item['truongdulieu']?></td>
                        <td><?php echo $item['dulieucu']?></td>
                        <td><?php echo $item['dulieumoi']?></td>
                        <td><?php echo $item['tennhanvien']?></td>
                    </tr>
                    <?php
                        }
                    ?>
            	</tbody>
            </table>
        </div>
        <div>
        <?php if($_GET['print'] !="true" ){ ?>
            <a  class="button" 
                href="<?php echo $this->pager->getURLQueryString('page', ((int)$page - 1))?>">Back</a>
            <a  class="button" 
                href="<?php echo $this->pager->getURLQueryString('page', ((int)$page + 1))?>">Next</a>
		<?php } ?>
        </div>
        
        <div class="clearer">&nbsp;</div>
        
        <div class="section-bottom"></div>
	</div>
</div>
<!--end-->
<script language="javascript">
function searchForm()
{
	var url =  "?route=deliman/nhatkyhethong";
		
	if($("#tungay").val() != "")
		url += "&tungay="+ $("#tungay").val();
	if($("#denngay").val() != "")
		url += "&denngay=" + $("#denngay").val();
	if($("#nhanvienid").val() != "")
		url += "&nhanvienid=" + $("#nhanvienid").val();
	
	window.location = url;
}
// Giu cho cac field tim kiem van ko doi
$("#tungay").val("<?php echo $_GET['tungay']?>");
$("#denngay").val("<?php echo $_GET['denngay']?>");
$("#nhanvienid").val("<?php echo $_GET['nhanvienid']?>");
$('#btnPrint').click(function(){
	
	var url = window.location+"&print=true";
	 var result = window.showModalDialog(url,"", "dialogWidth:1000px; dialogHeight:450px; center:yes");
});
</script>
<?php if($_GET['print'] =="true" ){ ?>
	<script language="javascript">
        window.print();
    </script>
<?php } ?>